#-- coding:UTF-8 --
from flask_wtf import Form
from wtforms import TextField, IntegerField, TextAreaField, SubmitField, RadioField,PasswordField,SelectField
from wtforms import validators,ValidationError
#from app import Users

class userNameForm(Form):
    name = TextField("user name",[validators.Required("please input user name")])
    email = TextField("email",[validators.Required("please input email"),validators.Email("please check the email")])
    passwordOne = PasswordField("input password",[validators.Required('pleasr input password')])
    passwordTwo = PasswordField("confirm password",[validators.Required('please confirm password')])
    submit = SubmitField("submit")
    
class userForm(Form):
    name = TextField("user_name",[validators.Required("please input user name")])
    email = TextField("email",[validators.Required("please input email"),validators.Email("please check the email")])
    passwordOne = PasswordField("input_password",[validators.Required('pleasr input password')])
    passwordTwo = PasswordField("confirm_password",[validators.Required('please confirm password')])
    submit = SubmitField("submit")
    
    

'''def validate_on_userName(self,field):
        if User.query.filter(User.username == field.data).first():
             raise ValidationError('用户名已使用')
        
        if len(field.data) < 3:
             raise ValidationError('用户名长度不能少于3个字符')

        if len(field.data) > 6:
             raise ValidationError('用户名长度不能大于6个字符')
    def validate_on_name(self,)'''